package JDK11基于嵌套的访问控制;

import java.lang.reflect.Field;

public class demo01 {
    public static void main(String[] args) {
        new OuterClass().new Inter().method();
    }
}

class OuterClass {
    private int outerInter;

    class Inter {
        public void method() {
            System.out.println("OuterInter:" + outerInter);
            Class clazz = OuterClass.class;
            try {
                Field f = clazz.getDeclaredField("outerInter");
                f.setInt(OuterClass.this, 100);
                System.out.println("OuterInter:" + outerInter);
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
}